package org.leo.dm.component.util;

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.Statement;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class DbUtil {
	static Logger log = LoggerFactory.getLogger(DbUtil.class);

	public static void close(ResultSet rs, Statement stmt, Connection conn) throws Exception {
		try {
			log.info("关闭ResultSet");
			if (rs != null && !rs.isClosed()) {
				rs.close();
			}
			log.info("关闭Statement");
			if (stmt != null && !stmt.isClosed()) {
				stmt.close();
			}
			log.info("关闭Connection");
			if (conn != null && !conn.isClosed()) {
				conn.close();
			}
		} catch (Exception e) {
			e.printStackTrace();
			throw e;
		}
	}

}
